<?php

namespace common\model;

use think\model\RelationModel;

class PlaylistItemModel extends RelationModel
{
    //自动验证
    protected $_validate = [
        ['playlist_package_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['task_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['entity_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['playlist_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['playlist_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['entity_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['task_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['sort_index', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['created_by', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['created', '', '', self::EXISTS_VALIDATE, 'integer'],
    ];

    //自动完成
    protected $_auto = [
        ['sort_index', 'auto_fill_default_id', self::MODEL_INSERT, 'function_with_data'],
        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
    ];
}
